package com.imooc.springboot.dubbo.nilinili.consumer.utils;

import io.jsonwebtoken.Claims;

public class JwtToUserId {
    public static String Jwt2UserId(String token){

        Claims claims = null;
        try {
            claims = JwtUtil.parseJWT(token);
        }
        catch (Exception e) {
            throw new RuntimeException("token非法");
        }

        return claims.getSubject();
    }
}
